package com.isoft.dailymanprovidor.controller;

import com.isoft.dailymanprovidor.bean.ResponseData;
import com.isoft.dailymanprovidor.entity.MeetingRoom;
import com.isoft.dailymanprovidor.service.MeetingRoomService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@CrossOrigin
@RestController
@Slf4j
@RequestMapping("/systemdailyman/meetingroom")
public class MeetingRoomController extends BaseController{
    @Autowired
    MeetingRoomService meetingRoomService;
    //分页获取全部会议室信息
    @GetMapping("/getall")
    public ResponseData getall(Integer currentPage, Integer size){
        return meetingRoomService.getallmeeting(currentPage, size);
    }
    /*分页获取会议室信息*/
    @GetMapping("/getallMeetingRoom")
    public ResponseData getallmeetingroomPage(Integer currentPage, Integer size, String name, String number){
        return meetingRoomService.getallmeetingroom(currentPage, size, name, number);
    }

    //验证会议室名称是否重复
    @GetMapping("/isexistmeetingroom")
    public ResponseData<Boolean> MeetingRoomExist(String name){
        return returnBoolean(meetingRoomService.meetingroonExist(name));
    }
    //新增会议室
    @PutMapping("/addmeetingroom")
    public ResponseData<Boolean> addmeetingroom(@RequestBody MeetingRoom meetingRoom){
        return returnBoolean(meetingRoomService.addmeetingroom(meetingRoom));
    }
    //修改会议室信息
    @PutMapping("/updatemeetingroom")
    public ResponseData<Boolean> updatemeetingroom(@RequestBody MeetingRoom meetingRoom){
        return returnBoolean(meetingRoomService.updatemeetingroom(meetingRoom));
    }
    //修改会议室状态
    @PutMapping("/updatestutas")
    public ResponseData<Boolean> uodatestatus(@RequestBody MeetingRoom meetingRoom){
        return returnBoolean(meetingRoomService.updatestatus(meetingRoom));
    }
    //删除会议室信息
    @DeleteMapping("/deletemeetingroom/{id}")
    public ResponseData<Boolean> deletemeetingroom(@PathVariable("id") Integer id){
        return returnBoolean(meetingRoomService.deletemeetingroom(id));
    }
}
